/*
 * @(#)MaintSysFavourForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.framework.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.bean.SysFavour;

/**
  MaintSysFavourForm.java

  This class is the for web form purpose.

  @author      Zoe Shum
  @company     DCIVision Limited
  @creation date   20/01/2004
  @version     $Revision: 1.3 $
*/

public class MaintSysFavourForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.3 $";

  private String parentID = null;
  private String objectType = null;
  private String objectID = null;
  private String argument = null;
  private String description = null;

  public MaintSysFavourForm() {
    super();
  }

  public String getParentID() { 
    return(this.parentID);
  }

  public void setParentID(String parentID) { 
    this.parentID = parentID;
  }

  public String getObjectType() { 
    return(this.objectType);
  }

  public void setObjectType(String objectType) { 
    this.objectType = objectType;
  }

  public String getObjectID() { 
    return(this.objectID);
  }

  public void setObjectID(String objectID) { 
    this.objectID = objectID;
  }

  public String getArgument() { 
    return(this.argument);
  }

  public void setArgument(String argument) { 
    this.argument = argument;
  }

  public String getDescription() { 
    return(this.description);
  }

  public void setDescription(String description) { 
    this.description = description;
  }
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setParentID(null);
    this.setObjectType(null);
    this.setObjectID(null);
    this.setArgument(null);
    this.setDescription(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    SysFavour tmpSysFavour = new SysFavour();
    tmpSysFavour.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpSysFavour.setParentID(TextUtility.parseIntegerObj(this.getParentID()));
    tmpSysFavour.setObjectType(this.getObjectType());
    tmpSysFavour.setObjectID(TextUtility.parseIntegerObj(this.getObjectID()));
    tmpSysFavour.setArgument(this.getArgument());
    tmpSysFavour.setDescription(this.getDescription());
    tmpSysFavour.setRecordStatus(this.getRecordStatus());
    tmpSysFavour.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpSysFavour.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpSysFavour.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpSysFavour.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpSysFavour.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpSysFavour;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    SysFavour tmpSysFavour = (SysFavour)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpSysFavour.getID()));
    this.setParentID(TextUtility.formatIntegerObj(tmpSysFavour.getParentID()));
    this.setObjectType(tmpSysFavour.getObjectType());
    this.setObjectID(TextUtility.formatIntegerObj(tmpSysFavour.getObjectID()));
    this.setArgument(tmpSysFavour.getArgument());
    this.setDescription(tmpSysFavour.getDescription());
    this.setRecordStatus(tmpSysFavour.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpSysFavour.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpSysFavour.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpSysFavour.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpSysFavour.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpSysFavour.getUpdateDate()));
  }
}
